package com.bzkj.web.controller.wms;

import com.bzkj.basicinfo.domain.wms.WmsWarningTypeInfoEntity;
import com.bzkj.basicinfo.service.wms.WmsWarningTypeInfoService;
import com.bzkj.common.annotation.LogC;
import com.bzkj.common.core.controller.BaseController;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * wms预警类型信息Controller
 *
 * @author ruoyi
 * @date 2025-02-26
 */
@Api(tags = "预警配置")
@RestController
@RequestMapping("/wms/warningType")
public class WmsWarningTypeInfoController extends BaseController {
    @Autowired
    private WmsWarningTypeInfoService wmsWarningTypeInfoService;

    /**
     * 查询wms预警类型信息列表
     */
    @ApiOperation("查询预警类型下拉接口")
    @GetMapping("list")
    public R selectWmsWarningTypeInfoList() {
        return wmsWarningTypeInfoService.selectWmsWarningTypeInfoList();
    }
    /**
     * 新增wms预警类型信息
     */
    @LogC(title = "wms预警类型信息", businessType = BusinessType.INSERT, pkFieldNames = "id",
            tableNames = "wms_warning_type_info", content = "'预警名称：'+#wmsWarningTypeInfo.warningTypeName"
    )
    @PostMapping
    public AjaxResult add(@RequestBody WmsWarningTypeInfoEntity wmsWarningTypeInfo) {
        return wmsWarningTypeInfoService.insertWmsWarningTypeInfo(wmsWarningTypeInfo);
    }

    /**
     * 修改wms预警类型信息
     */
    @ApiOperation("修改接口")
    @PutMapping("updataWmsWarningType")
    @LogC(title = "wms预警类型信息", businessType = BusinessType.UPDATE,tableNames = "wms_warning_type_info",pkFieldNames = "id",
    content = "'预警名称：'+#wmsWarningTypeInfo.warningTypeName")
    public AjaxResult edit(@RequestBody WmsWarningTypeInfoEntity wmsWarningTypeInfo) {
        return wmsWarningTypeInfoService.updateWmsWarningTypeInfo(wmsWarningTypeInfo);
    }

    /**
     * 删除wms预警类型信息
     */
    @DeleteMapping("/deleteWmsWarningType")
    @LogC(title = "wms预警类型信息", businessType = BusinessType.INVALID,
            content = "'预警类型id：'+#id")
    public AjaxResult remove(@RequestParam("id") Integer id) {
        return wmsWarningTypeInfoService.deleteWmsWarningTypeInfoById(id);
    }
}
